package org.com.fw.util;

import java.security.MessageDigest;

import org.springframework.security.crypto.codec.Base64;

public class EncryptUtil {
  
	/**
	 * SHA-256 加密
	 * 
	 * @param inputStr
	 * @return
	 */
	public static synchronized String encryptSha256(String inputStr) {
	  try {
		  MessageDigest md = MessageDigest.getInstance("SHA-256");
		  byte[] digest = md.digest(inputStr.getBytes("UTF-8"));
		  return new String(Base64.encode(digest)); 
	  } catch (Exception e) {}
	  return null;
	}
}